#include <iostream>
#include <signal.h>

void handlerSig(int sig) {
    std::cout << "获得了一个信号: " << sig << std::endl;
}

int main() {
    signal(SIGINT, handlerSig);
    int cnt = 0;
    while(1) {
        std::cout << "hello" <<std::endl;
        sleep(1);
    }
    return 0;
}